<template>
  <div>
    <Title :title="'实时上下游流量'"/>
    <div class="box">
      <div class="boxBack">
        <span>{{ '东进口流量：' + dataList[0] }}</span>
        <span>{{ '南进口流量：' + dataList[1] }}</span>
        <span>{{ '西进口流量：' + dataList[2] }}</span>
        <span>{{ '北进口流量：' + dataList[3] }}</span>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs, computed, onMounted } from 'vue';
import Title from './title.vue'
// import { xiaoche } from '@/assets/images/imagesIn'
import { getJunctionFlowIndex } from '../../../utils/apiComponent'

export default defineComponent({
  name: 'ComponentOne',
  components: {
    Title,
  },
  setup() {
    const data = reactive({
      dataList: [1,1,1,1]
    })
    const initData = () => {
      getJunctionFlowIndex().then((res) => {
        data.dataList = res
      })
    }
    onMounted(() => {
      initData()
    })
    const refData = toRefs(data)
    return {
      ...refData,
    }
  }
})
</script>

<style lang="less" scoped>
.box{
  width: 100%;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  .boxBack{
    width: 100%;
    height: 240px;
    background-image: url('@{publicPath}static/images/road/flow.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    position: relative;
    span:nth-child(1){
      position: absolute;
      top: 40px;
      right: 80px;
    }
    span:nth-child(2){
      position: absolute;
      bottom: 40px;
      right: 80px;
    }
    span:nth-child(3){
      position: absolute;
      bottom: 40px;
      left: 80px;
    }
    span:nth-child(4){
      position: absolute;
      top: 40px;
      left: 80px;
    }
  }
}
</style>